package thread;

//Runnable 的作用是描述一个要“执行的任务”，run方法就是任务的执行细节
class MyRunnable implements Runnable {
    @Override
    public void run() {
        System.out.println("hello 张三");
    }
}

public class ThreadDemo2 {
    public static void main(String[] args) {
        //这只是描述了任务
        Runnable runnable = new MyRunnable();
        //把任务交给线程来执行
        Thread thread = new Thread(runnable);
        thread.start();
    }
}
